
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syn_4s/core/extension/int_extension.dart';
import 'package:syn_4s/ui/shared/app_theme.dart';
import 'package:syn_4s/ui/widgets/shadow_container.dart';
import 'dialog_title.dart';

class GoogleMapCenterDialog extends StatelessWidget {

  final String title;

  const GoogleMapCenterDialog(this.title, {super.key});

  @override
  Widget build(BuildContext context) {
    return PopScope(
      canPop: false,
      child: Dialog(
        child: ShadowContainer(
          width: 300.px,
          padding: EdgeInsets.all(8.px),
          child: buildDialogContent()
        ),
      ),
    );
  }

  Widget buildDialogContent(){
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        DialogTitle(title, ""),
        SizedBox(height: 20.px),
        SvgPicture.asset("assets/images/map_alert.svg", width: 80.px, height: 80.px,),
        SizedBox(height: 10.px,),
        getText("Wearer:王五", color: AppTheme.orangeColor, size: 16.px),
        SizedBox(height: 6.px,),
        getText("Tel:(86)13548965789", color: AppTheme.orangeColor, size: 16.px),
        SizedBox(height: 6.px,),
        getText("Please help immediately", size: 14.px),
        getText("Add:102 Tsuen King Circuit, Tsuen Wan", size: 14.px),
        SizedBox(height: 20.px,)
      ],
    );
  }

  Widget getText(String text,{double? size, FontWeight? fontWeight, Color color = AppTheme.textColor}){
    return Text(
      text,
      style: TextStyle(
          fontSize: size,
          fontWeight: fontWeight,
          color: color
      ),
      overflow: TextOverflow.ellipsis,
      maxLines: 2,
    );
  }
}
